package admin.controller;


import admin.common.Result;
import admin.entity.Checkitem;
import admin.service.CheckitemService;
import admin.util.PageResult;
import admin.util.PageQuery;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wjd
 * @since 2024-11-21
 */
@RestController
@RequestMapping("/checkitem")
public class CheckitemController {

    @Resource
    private CheckitemService checkitemService;

    //展示检查项的信息
    @RequestMapping("/findPageInfo")
    public PageResult findPageInfo(@RequestBody PageQuery pageQuery){

        PageResult pageResult = checkitemService.findPageInfo(pageQuery);
        return pageResult;

    }

    //删除检查项的方法
    @RequestMapping("/deleteInfoById")
    public Result deleteInfoById(Integer id){
        //service帮我们完成业务
        Result result = checkitemService.deleteInfoById(id);
        return result;
    }

    //添加 更新
    @RequestMapping("/addItemInfo")
    public Result addItemInfo(@RequestBody Checkitem checkitem){
        Result result = checkitemService.addItemInfo(checkitem);
        return result;
    }

    //编辑数据（回显）
    @RequestMapping("/getItemInfoById")
    public Result getItemInfoById(Integer id){
        Result result = checkitemService.getItemInfoById(id);
        return result;
    }

    @RequestMapping("/getAllItemInfo")
    public Result getAllItemInfo(){
        Result result = checkitemService.getAllItemInfo();
        return result;
    }

}

